'''
常用的元素操作的方法：
clear()
send_keys()
click()
submit()
text
get_attribute()


'''
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from options import options
from service import service

dr=webdriver.Chrome(options=options,service=service)
dr.get(r'https://www.baidu.com/')
text=dr.find_element(By.LINK_TEXT,'新闻').text
sleep(1)
print(text)
href=dr.find_element(By.CSS_SELECTOR,'#s-top-left > a:nth-child(1)').get_attribute('href')
sleep(1)
print(href)

is_displayed = dr.find_element(By.XPATH, '//*[@id="bottom_layer"]/div/p[6]/a').is_displayed()
print(is_displayed)
dr.quit()
